{% extends "base.html" %}

{% block content %}
  <h2> {{ _('Register or Log in') }} </h2>
  <form id="fake_fxa_authorization" method="get" action="{{ url('auth:accounts.authenticate') }}">
    <h3> Don't panic! </h3>
    <p>
      You're seeing this page instead of the regular authentication page because the
      <code>FXA_CONFIG</code> being used has the client_id set to <code>.</code> and
      `<code>ENV</code> is set to <code>local</code>.
      This is used to trigger fake authentication without redirecting to an actual
      authentication server.
    </p>
    <p> Because this is a fake authentication page, you don't need to enter a password, and you also don't need to control the email address. This can be be used to log in to the admin pages which normally require an account with <code>@mozilla.com</code> email address. </p>
    {% for key, value in request.GET.items() %}
      <input type="hidden" name="{{ key }}" value="{{ value }}" />
    {% endfor %}
    <input type="hidden" name="code" value="fakecode" />
    <label for="id_email">{{ _('Email:') }}</label> <input type="email" name="fake_fxa_email" id="id_email" />
    <label><input type="checkbox" name="fake_two_factor_authentication" value="true" />{{ _('Two-factor authentication') }}</label>
    <input type="submit" value="{{ _('OK') }}" />

    {% if interesting_accounts %}
      <h3> Special accounts </h3>
      <p> The accounts listed below already exist and belong to a group, so they might be interesting to you. Click on an email to automatically log in with the corresponding account.</p>
      <div class="prose">
        <ul class="accounts">
          {% for user in interesting_accounts %}
            <li> <a href="mailto:{{ user.email }}">{{ user.email }}</a> ({% for group in user.groups_list %}{{ group.name }}{% if not loop.last %}, {% endif %}{% endfor %})</li>
          {% endfor %}
        </ul>
      </div>
    {% endif %}
  </form>
{% endblock %}
